interface Function {
    myBind: (params: any, ...args: any[]) => Function
}

Function.prototype.myBind = function(context: any, ...args: any[]) {
    const fn = this, outArgs = args
    return function Fn(this: any, ...fnArgs: any[]) {
        console.log([...outArgs, ...fnArgs])
        return fn.apply(this instanceof Fn ? this : context, [...outArgs, ...fnArgs])
    }
}

function foo3(this: any, ...arr: any[]) {
    console.log(this.name, arr)
}

let feed = foo3.myBind({name: 'kaho'}, 1, 2)

feed(3, 4, 5)
